package qlvbdq.bo;

import java.sql.SQLException;
import java.util.ArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;
import qlvbdq.dao.ThoGiaCongDAO;
import qlvbdq.dto.ThoGiaCongDTO;

/**
 *
 * @author THAI HA
 */
public class ThoGiaCongBO {

    public ThoGiaCongBO() {
    }

    public boolean insertThoGiaCong(ThoGiaCongDTO tgcdto_) {
        return new ThoGiaCongDAO().InsertThoGiaCong(tgcdto_) > 0;
    }

    public boolean deleteThoGiaCong(ThoGiaCongDTO tgcdto_) {
        return new ThoGiaCongDAO().DeleteThoGiaCong(tgcdto_) > 0;
    }

    public String getNewMaThoGiaCong() {
        try {
            return new ThoGiaCongDAO().getNewMaThoGC();
        } catch (SQLException ex) {
            System.err.println();
            return null;
        }
    }

    public boolean updateThoGiaCong(ThoGiaCongDTO tgcdto_) {
        return new ThoGiaCongDAO().UpdateThoGiaCong(tgcdto_) > 0;
    }
    
    public ArrayList<ThoGiaCongDTO> getAllThoGiaCong(){
        return null;
    }
    
    public ArrayList<ThoGiaCongDTO> getThoGiaCongByRule(ThoGiaCongDTO tgcdto){
        try {
            return new ThoGiaCongDAO().GetThoGiaCongByRule(tgcdto);
        } catch (SQLException ex) {
            Logger.getLogger(ThoGiaCongBO.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        }
    }
}
